
<div class="tipbox tipbox-message mb10">
    友情提示:引导图片大小,推荐[600px*240px],普通[正方形]
</div>
<form id="form" action="{:url('ask/add')}">
<input type="hidden" id="ad_img" name="ad_img" value=""/>
    <table class="formtable">
        <tr>
            <th>问题类型:</th>
            <td>
                <label>是否推荐：</label>
                <select class="select w100" name="is_ad" class="select" datatype="*">
                    <option value="0">普通</option>
                    <option value="1">推荐</option>
                </select>
                <label>是否置顶：</label>
                <select class="select w100" name="is_top" class="select" datatype="*">
                    <option value="0">普通</option>
                    <option value="1">置顶</option>
                </select>
            </td>
        </tr>
        <tr><th>引导图片</th><td id="imgbox">
            <div class="box-view"></div>
        </td></tr>
        <tr>
            <th>问题分类:</th>
            <td>
                <select class="select w500" name="category_id" class="select" datatype="*">
                    <option value="">选择问题分类</option>
                    {foreach $category as $rs}<option value="{$rs.id}">{$rs.title}</option>{/foreach}
                </select>
            </td>
        </tr>
        <tr><th>问题名称:</th><td><input class="input w500" datatype="*" type="text" name="title" /></td></tr>
        <tr><th>问题简述:</th><td><textarea class="textarea h80 w500" datatype="*" type="text" name="note"></textarea></td></tr>
        <tr><th>问题详情:</th><td><textarea class="textarea ui-editor" name="content"></textarea></td></tr>
        <tr><th>问题价格:</th><td><input class="input w80" datatype="*" type="text" name="price" value="0" /> <span class="gray">需要支付费用才允许查看解决方案</span></td></tr>
        <tr><th>解决方案:</th><td><textarea class="textarea ui-editor" name="answer"></textarea></td></tr>
        <tr>
            <th></th>
            <td>
                <input type="submit" value="确定" class="button button-blue submit" />
                <input type="reset" value="重置" class="button button-blank"/>
            </td>
        </tr>
    </table>
</form>
<script type="text/javascript">
Do('base','layer','editor','form',function(){
    $('#form').isForm({'upload':'{:url("system/passport.common/upload")}'});
    $(".box-view").click(function(){openwin('{:url("system/passport.common/upload")}')});
    $('select[name=is_ad]').change(function(){
        var id =  $("select[name=is_ad] option:checked").val();
        1 == id ? $(".box-view").addClass('w500'):$(".box-view").removeClass('w500');
    });
})
//添加图片
function setImg(show_src){
    $("#ad_img").val(show_src);
    $(".box-view").html('<img src="'+show_src+'">');  
}
</script>